
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="description" content="">
    <meta name="author" content="">

    <title>{$sysPageTitle}</title>

    <link href="__PUBLIC__/images/favicon.ico" rel="shortcut icon" />

    <!-- Bootstrap core CSS -->
    <link rel="stylesheet" href="__PUBLIC__/css/bootstrap.min.css" />
    <link rel="stylesheet" href="__PUBLIC__/css/bootstrap-theme.min.css" />
    <link rel="stylesheet" href="__PUBLIC__/css/dashboard.css" />
    <link rel="stylesheet" href="__PUBLIC__/css/icheck/all.css" />
</head>

<body>

<include file="Common/topNav" />

<div class="container-fluid">
    <div class="row">
        <include file="Common/leftMenu" />
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
            <div class="cont-title clearfix">
                <div class="title">用户预约列表</div>
            </div>
            <include file="search" />
            <div class="table-responsive">
                <table class="table table-striped table-hover" id="tableData">
                    <thead>
                    <tr>
                        <th>序号</th>
                        <th>预约人</th>
                        <th>联系电话</th>
                        <th>预约时间</th>
                        <th>预约事项</th>
                        <th>服务用户</th>
                        <th>服务部门</th>
                        <th>创建时间</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <empty name="bespeakList">
                        <tr>
                            <td colspan="10">没有相关记录</td>
                        </tr>
                    </empty>
                    <foreach name="bespeakList" item="bespeak">
                        <tr>
                            <td>{$key|getLineNum=$nowPage,$pageSize}</td>
                            <td>{$bespeak.member_name|default=$bespeak['member']['real_name']}</td>
                            <td>{$bespeak.mobile}</td>
                            <td>{$bespeak.order_time|date="Y-m-d",###} / {$bespeak.time_range}</td>
                            <td class="bespeak_content" title="{$bespeak.member_name|default=$bespeak['member']['real_name']}" data-toggle="popover" data-content="{$bespeak.content|default='暂无预约事项'}">{$bespeak.content|msubstr=###,0,10,"utf-8",true}</td>
                            <td>{$bespeak.user.real_name}</td>
                            <td>{$bespeak.org.name}</td>
                            <td>{$bespeak.create_time|date="Y-m-d H:i",###}</td>
                            <td>
                                <switch name="bespeak.status">
                                    <case value="0"><span class="label label-danger">已取消</span></case>
                                    <case value="1"><span class="label label-primary">未开始</span></case>
                                    <case value="2"><span class="label label-success">已结束</span></case>
                                    <case value="3"><span class="label label-info">进行中</span></case>
                                    <default />正常
                                </switch>
                            </td>
                            <td>
                                <if condition="$bespeak.status eq 1">
                                    <a thisId="{$bespeak['id']}" class="editBespeak" href="javascript:void(0);">取消</a>
                                <else/>
                                    -
                                </if>
                            </td>
                        </tr>
                    </foreach>
                    </tbody>
                </table>
                <div class="page">
                    {$page}
                </div>
            </div>
        </div>
    </div>
</div>


<include file="Common/modalHtmls" />
<script type="text/javascript" src="__PUBLIC__/js/jquery.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/bootstrap.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/icheck.min.js"></script>
<script type="text/javascript">
    $(function () {
        $(".editBespeak").click(function(){
            var bespeakId = $(this).attr("thisId");
            cancel(bespeakId);
        });
        $(".bespeak_content").popover({
            trigger: "hover",
            container: "body",
            placement: "right"
        });
    });
    function cancel(id) {
        common.confirm("提示","确认要取消该预约吗？",function(){
            var param = {id:id};
            $.ajax({
                url: "{:U('Admin/Appointment/cancelBespeak')}",
                type: "post",
                dataType: "json",
                data: param,
                success: function (data) {
                    common.alert("提示", data.msg, function () {
                        if (data.status) {
                            common.reload();
                        }
                    });
                }
            });
        });
    }
</script>
</body>
</html>
